package activitytest.example.com.application;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.View;
import android.widget.Toast;

import activitytest.example.com.application.utils.SpUtils;
import activitytest.example.com.application.view.SettingItemView;

/**
 * Created by zhanyihong on 2017/12/6.
 */

public class setup2Activity extends Activity {
    private SettingItemView siv_sim_bind;
    private boolean isCheck;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setup2);

        initUI();
    }

    private void initUI() {
         siv_sim_bind = ( SettingItemView) findViewById(R.id.siv_sim_bind);
        String sim_number = SpUtils.getString(this,ConstantValue.SIM_NUMBER,"");
        if (TextUtils.isEmpty(sim_number)){
            siv_sim_bind.setCheck(false);
        }else {
            siv_sim_bind.setCheck(true);
        }
        siv_sim_bind.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                isCheck = siv_sim_bind.isCheck();
                siv_sim_bind.setCheck(!isCheck);
            }
        });
    }

    public void  nextPage(View view){
        if (isCheck){
            Toast toast = Toast.makeText(getApplicationContext(), "请确定更新", Toast.LENGTH_SHORT);
            toast.show();
        }else {
            Intent intent3 = new Intent(getApplicationContext(), Setup3Activity.class);
            startActivity(intent3);

            finish();
        }

    }
    public void  prePage(View view){
        Intent intent3 = new Intent(getApplicationContext(), Setup1Activity.class);
        startActivity(intent3);

        finish();
        overridePendingTransition(R.anim.pre_in_anim,R.anim.pre_out_anim);
    }
}
